<?php

namespace app\index\controller;

use think\Controller;
use think\Db;

class Video extends Common
{
    protected $video;
    public function __construct()
    {
        parent::__construct();
        $this->video=new \app\common\model\Video();
    }

    public function index(){
       if(!empty(input('param.video_id'))){
           $video_id=input('param.video_id');
           $play=$this->video->where('video_id',$video_id)->find();
       }
       if(!empty(input('param.pro_id'))){
           $pro_id=input('param.pro_id');
           $play=$this->video->where('video_pro_id',$pro_id)->order('video_sort asc')->find();
       }
       if(empty($play)){
           $play="";
           $this->assign('play',$play);
           return $this->fetch();
       }
       $project=Db::name('project')->where('pro_id',$play['video_pro_id'])->find();
       $videoList=$this->video->where('video_pro_id',$play['video_pro_id'])->select();
       $this->assign('play',$play);
       $this->assign('project',$project);
       $this->assign('videoList',$videoList);
       return $this->fetch();
    }
}
